* The X error handling routine.
*
* Arguments:
- * "display" is the X display the error orignated from.
+ * "display" is the X display the error originated from.
* "error" is the XErrorEvent that we are handling.
*
* Results:
{
gchar buf[64];
gchar *msg;
-
+
XGetErrorText (display, error->error_code, buf, 63);
msg =
" backtrace from your debugger if you break on the gdk_x_error() function.)",
g_get_prgname (),
buf,
- error->serial,
- error->error_code,
+ error->serial,
+ error->error_code,
error->request_code,
error->minor_code);
-
-#ifdef G_ENABLE_DEBUG
+
+#ifdef G_ENABLE_DEBUG
g_error ("%s", msg);
#else /* !G_ENABLE_DEBUG */
g_fprintf (stderr, "%s\n", msg);
}
_gdk_error_code = error->error_code;
}
-
+
return 0;
}
exit(1);
}
-/*************************************************************
- * gdk_error_trap_push:
- * Push an error trap. X errors will be trapped until
- * the corresponding gdk_error_pop(), which will return
- * the error code, if any.
- * arguments:
- *
- * results:
- *************************************************************/
-
void
gdk_error_trap_push (void)
{
node->next = gdk_error_traps;
gdk_error_traps = node;
-
+
trap = node->data;
trap->old_handler = XSetErrorHandler (gdk_x_error);
trap->error_code = _gdk_error_code;
_gdk_error_warnings = 0;
}
-/*************************************************************
- * gdk_error_trap_pop:
- * Pop an error trap added with gdk_error_push()
- * arguments:
- *
- * results:
- * 0, if no error occured, otherwise the error code.
- *************************************************************/
-
gint
gdk_error_trap_pop (void)
{
node->next = gdk_error_trap_free_list;
gdk_error_trap_free_list = node;
-
+
result = _gdk_error_code;
-
+
trap = node->data;
_gdk_error_code = trap->error_code;
_gdk_error_warnings = trap->error_warnings;
XSetErrorHandler (trap->old_handler);
-
+
return result;
}